package com.wzapp.sitposture.usercenter.service.impl;

import com.wzapp.sitposture.common.page.PageParam;
import com.wzapp.sitposture.common.util.PageUtil;
import com.wzapp.sitposture.usercenter.repository.UserLoginLogRepository;
import com.wzapp.sitposture.usercenter.service.UserLoginLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;

/**
 * 功能:
 *
 * @author ql
 * @version 1.0
 * @create 2018-10-30 18:56
 **/
@Service
public class UserLoginLogServieImpl implements UserLoginLogService {

    @Autowired
    UserLoginLogRepository userLoginLogRepository;

    @Override
    public Page<String> findUserIdByLoginTimeGreaterThan(Timestamp loginTime, PageParam pageParam) {
        pageParam = PageUtil.initPageParam(pageParam);
        Pageable pageable = new PageRequest(pageParam.getPageNum(),pageParam.getPageSize());
        return userLoginLogRepository.findUserIdByLoginTimeGreaterThan(loginTime,pageable);
    }
}
